home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / graphics.17 / graphics / graphics-0.17 / plot2tek / cont.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-12  |  2.5 KB  |  69 lines

  1. /* libtek, a library of functions for tektronics 4010 compatible devices.
  2.    Copyright (C) 1989 Free Software Foundation, Inc.
  3.  
  4. libtek is distributed in the hope that it will be useful, but WITHOUT ANY
  5. WARRANTY.  No author or distributor accepts responsibility to anyone for the
  6. consequences of using it or for whether it serves any particular purpose or
  7. works at all, unless he says so in writing.  Refer to the GNU General Public
  8. License for full details.
  9.  
  10. Everyone is granted permission to copy, modify and redistribute libtek, but
  11. only under the conditions described in the GNU General Public License.  A copy
  12. of this license is supposed to have been given to you along with libtek so
  13. you can know your rights and responsibilities.  It should be in a file named
  14. COPYING.  Among other things, the copyright notice and this notice must be
  15. preserved on all copies.  */
  16.  
  17. /* This file is the cont routine, which is a standard part of the plot
  18.    library. It continues a line from the last point drawn to the point
  19.    specified by x and y.
  20.    */
  21. #include "sys-defines.h"
  22. #include "libplot.h"
  23.  
  24. double x_input_min = 0.; /* minimum input x coordinate */
  25. double y_input_min = 0.; /* minimum input y coordinate */
  26. double x_output_min = 0.; /* minimum output x coordinate */
  27. double y_output_min = 0.; /* minimum output y coordinate */
  28. double x_output_max = 767.; /* maximum-minimum output x coordinate */
  29. double y_output_max = 767.; /* maximum-minimum output y coordinate */
  30. double scaleup = 1.; /* default input to output scaleing for both x and y */
  31.  
  32. int last_x=0, last_y = 0; /* location of the last coordinates used */
  33.  
  34. /* this bit vector represents the line style (eg. dashed) for
  35.    idraw.  We intitialize it to all ones which represents a solid
  36.    line. */
  37. long line_type_bit_vector = 65535;
  38.  
  39. /* this is a string that should conatain a postscript vector
  40.    argument for the postscript setdash command.  This is allocted
  41.    in the open(3) function. */
  42. char *line_type_setdash;
  43.  
  44. /* the current length of the above buffer */
  45. int line_type_setdash_length;
  46.  
  47. /* one greater than the length in number of bits in the dash pattern.  */
  48.  
  49. int line_type_setdash_bits=0;
  50.  
  51.  
  52.  
  53. int
  54. cont (x, y)
  55.      int x, y;
  56. {
  57.   last_x = x;
  58.   last_y = y;
  59.   
  60.   x = (x - x_input_min)/ scaleup + x_output_min;
  61.   y = (y - y_input_min)/ scaleup + y_output_min;
  62.  
  63.   putchar (((y>>5)&0x1F)|0x20); /* bits 5 through 9 of y */
  64.   putchar (( y    &0x1F)|0x60); /* bits 0 through 4 of y */
  65.   putchar (((x>>5)&0x1F)|0x20); /* bits 5 through 9 of x */
  66.   putchar (( x    &0x1F)|0x40); /* bits 0 through 4 of x */
  67.   return 0;
  68. }
  69.